<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/common/taglib.jsp"%>
<%@ include file="/WEB-INF/common/header.jsp"%>

	<div>
		<div class="layui-fluid">
			<div class="layui-row layui-col-space1">
				<div class="layui-col-md12">
					<div class="layui-form-query">
						<form class="layui-form" id="query_form">
							<div class="layui-form-item">
								
								<div class="layui-inline">
									<label class="layui-form-mid">主键：</label>
									<div class="layui-input-inline" style="width:60px;">
										<input type="text" name="id" autocomplete="off" class="layui-input" placeholder="主键" />
									</div>
								</div>
								
								<div class="layui-inline">
									<label class="layui-form-mid">模板标题：</label>
									<div class="layui-input-inline" style="width:120px;">
										<input type="text" name="title" autocomplete="off" class="layui-input" placeholder="模糊查询" />
									</div>
								</div>
								
								<div class="layui-inline">
									<label class="layui-form-mid">微信模板ID：</label>
									<div class="layui-input-inline" style="width:200px;">
										<input type="text" name="templateCode" autocomplete="off" class="layui-input" placeholder="模糊查询" />
									</div>
								</div>
								
								<div class="layui-inline">
									<label class="layui-form-mid">状态：</label>
									<div class="layui-input-inline" style="width:100px;">
										<select name="status" lay-verify="required">
									   		<option value="">全部</option>
									        <option value="0">启用</option>
									        <option value="9">禁用</option>
									   	</select>
									</div>
								</div>
								
								<div class="layui-inline">
									<label class="layui-form-mid">appid：</label>
									<div class="layui-input-inline">
										<c:choose>
									      	<c:when test="${type == 0 }">
										    	<select name="appid" class="fsSelect fsDict" isLoad="1" dict="wxConfigList0" addNull="1" lay-verify="required"></select>
									      	</c:when>
									      	<c:otherwise>
									      		<select name="appid" class="fsSelect fsDict" isLoad="1" dict="wxConfigList1" addNull="1" lay-verify="required"></select>
									      	</c:otherwise>
										</c:choose>
									</div>
								</div>
								
								<div class="layui-inline">
									<div class="layui-input-inline">
										<button class="layui-btn" type="button" function="query"><i class="layui-icon">&#xe615;</i>查询</button>
										<button class="layui-btn layui-btn-danger" type="reset" function="clean">清空</button>
									</div>
								</div>
							</div>
						</form>
					</div>
				</div>
				
				<div class="layui-col-md12">
					<div class="layui-row grid-demo">
						<div class="layui-col-md12">
							<button class="layui-btn layui-btn-sm" function="top" topUrl="${ctx }/wx/temp/addView"
								topWidth="680px" topHeight="440px" isMaximize="0" topTitle="新增微信模板" inputs="type:${type}">
								<i class="layui-icon">&#xe654;</i>新增
							</button>
							<button class="layui-btn layui-btn-sm" function="refresh">
								<i class="layui-icon">&#x1002;</i>刷新
							</button>
						</div>
						
						<div class="layui-col-md12">
							<table id="fsDatagrid" lay-filter="fsDatagrid" class="fsDatagrid"
								isLoad="1" url="${ctx }/wx/temp/list?type=${type }" isPage="1" sortType="1"
								pageSize="10" defaultForm="query_form" height="340" clickRenderTable="fsDatagrid2" clickRenderTableInputs="wxTempId:$id"></table>

							<div class="fsDatagridCols">
								<p field="id" title="主键" width="80" sort="true" />
								<p field="title" title="模板标题" width="150" sort="true" />
								<p field="templateCode" title="微信模板ID" width="400" sort="true" />
								<p field="type" title="模板类型" width="150" sort="true" dict="wxTempType" />
								<p field="status" title="状态" width="100" sort="true" templet="#statusTemp" />
								<p field="appid" title="模板发送通道" width="200" sort="true" templet="#appidTemp" />
								<p align="center" toolbar="#actionTemp" title="操作" width="220"/>
							</div>

							<script type="text/html" id="statusTemp">
								<input type="checkbox" lay-skin="switch" disabled lay-text="启用|禁用" {{ d.status == 0 ? 'checked' : '' }}>
							</script>
							<script type="text/html" id="appidTemp">
								<a href="#" class="">{{d.appid}}</a>
							</script>
							<script type="text/html" id="actionTemp">
								<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="top" topUrl="${ctx }/wx/temp/detail" topMode="readonly" topWidth="680px" topHeight="440px" topTitle="{{d.title}}-详情" inputs="id:">查看</a>
				 				<a class="layui-btn layui-btn-xs" lay-event="top" topUrl="${ctx }/wx/temp/addView" topWidth="680px" topHeight="500px" topTitle="{{d.title}}-编辑" inputs="id:,type:">编辑</a>
{{# if (d.status == 0){ }}
	<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="submit" url="${ctx }/wx/temp/del" isConfirm="1" method="post" confirmMsg="确定停用当前记录吗？" inputs="id:,status:9">停用</a>
{{# }else{ }}
	<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="submit" url="${ctx }/wx/temp/del" isConfirm="1" method="post" confirmMsg="确定启用当前记录吗？" inputs="id:,status:0">启用</a>
{{# } }}
							</script>
							 
						</div>
					</div>
				</div>
				
				<hr class="layui-bg-red">
				
				<div class="layui-col-md12"><div class="layui-form-query"><form class="layui-form" id="query_form2"><input type="hidden" id="wxTempId" name="wxTempId" autocomplete="off" class="layui-input"/></form></div></div>
				<div class="layui-col-md12">
			    	<div id="table_buttion_div">
				    	<button class="layui-btn layui-btn-sm" function="top" tableId="fsDatagrid2" topUrl="${ctx }/wx/temp/content/addView" 
				    	topWidth="650px" topHeight="580px" isMaxWindow="" topTitle="新增模板内容" inputs="wxTempId:#wxTempId">
							<i class="layui-icon">&#xe654;</i>新增
						</button>
						<button class="layui-btn layui-btn-sm" function="refresh" tableId="fsDatagrid2">
							<i class="layui-icon">&#x1002;</i>刷新
						</button>
			    	</div>
			    </div>
				<div class="layui-col-md12">
			  	 	<table id="fsDatagrid2" class="fsDatagrid" lay-filter="fsDatagrid2" url="${ctx }/wx/temp/content/list" isLoad="0" defaultForm="query_form2" height="280" isPage="1"></table>
					
					<div class="fsDatagridCols">
					    <p field="id" title="主键" width="100" />
					    <p field="keyData" title="模板键值" width="150" />
					    <!-- <p field="color" title="模板颜色" width="100" templet="#colorTemp" /> -->
						<p field="content" title="模版内容" width="400" templet="#colorTemp" />
					    <p field="enlarge" title="是否放大" width="100" templet="#enlargeTemp" />
					    <p field="status" title="状态" width="100" templet="#statusTemp" />
					    <p field="note" title="备注" width="200"/>
					    <p fixed="right" align="center" toolbar="#barDemo2" title="操作" width="150"/>
					</div>
					
					<script type="text/html" id="statusTemp">
						<input type="checkbox" lay-skin="switch" disabled lay-text="启用|禁用" {{ d.status == 0 ? 'checked' : '' }}>
					</script>
					<script type="text/html" id="colorTemp">
						<span class="layui-badge-dot" style="background-color:{{d.color}}"></span>&nbsp;<span style="color:{{d.color}}">{{d.content}}</span>
					</script>
					<script type="text/html" id="enlargeTemp">
						{{# if (d.enlarge == 0){ }} 否 {{# } else { }} 是 {{# } }}
					</script>
					<script type="text/html" id="barDemo2">
						<a class="layui-btn layui-btn-xs" lay-event="top" topUrl="${ctx }/wx/temp/content/addView" topWidth="650px" topHeight="630px" topTitle="编辑模板内容" inputs="id:,wxTempId:#wxTempId">编辑</a>
						<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="submit" url="${ctx }/wx/temp/content/del" isConfirm="1" method="post" confirmMsg="确定删除当前记录吗？" inputs="id:">删除</a>
					</script>
			  	 </div>
				
			</div>
		</div>
	</div>

<%@ include file="/WEB-INF/common/bottom.jsp"%>
